package com.study.happystudy.po;

import lombok.Data;

import java.util.Collections;
import java.util.List;

@Data
public class Question {
    private int questionId;
    private String questionType;
    private int score;
    private String description;
    private List<String> options;
    private String correctAnswer;
    private int subjectId;
    private String analysis;

    public int getQuestionId() {
        return questionId;
    }

    public void setQuestionId(int questionId) {
        this.questionId = questionId;
    }

    public String getQuestionType() {
        return questionType;
    }

    public void setQuestionType(String questionType) {
        this.questionType = questionType;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<String> getOptions() {
        return options;
    }

    public void setOptions(String options) {
        if (options != null) {
            // Split the string and create an immutable list
            this.options = List.of(options.split("\\|\\|"));
        } else {
            // Set options to null or an empty list, depending on your requirement
            this.options = Collections.emptyList();
        }
    }


    public String getCorrectAnswer() {
        return correctAnswer;
    }

    public void setCorrectAnswer(String correctAnswer) {
        this.correctAnswer = correctAnswer;
    }

    public int getSubjectId() {
        return subjectId;
    }

    public void setSubjectId(int subjectId) {
        this.subjectId = subjectId;
    }

    public String getAnalysis() {
        return analysis;
    }

    public void setAnalysis(String analysis) {
        this.analysis = analysis;
    }
}
